package com.winchain.chainbill.bill.biz.receive.rx;

import com.shell.framework.rx.OnErrorNotImplementedSubscriber;
import com.winchain.chainbill.basic.activity.service.BasCusCpnService;
import com.winchain.chainbill.bill.base.po.CbRcv;
import com.winchain.chainbill.bill.base.po.CbRec;
import com.winchain.chainbill.bill.biz.Bill;
import com.winchain.chainbill.bill.biz.BillEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BillRcvTranSendCouponSubscriber extends OnErrorNotImplementedSubscriber<BillEvent<CbRcv>> {
	@Autowired
	private BasCusCpnService basCusCpnService;

	public void onApplicationEvent(BillEvent<CbRcv> t) {
		CbRec rec = t.getBill().getRec();
		CbRcv cbRcv = (CbRcv) t.getBill().getSource();
		this.basCusCpnService.sendCusCpn(cbRcv.getBuyerId(), new String[] { rec.getGrpId() });
	}
}
